home *** CD-ROM | disk | FTP | other *** search
- Path: news.bridge.net!news
- From: David Byrden <100101.2547@compuserve.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Assembler / C++ class not working!
- Date: 23 Feb 1996 18:10:59 GMT
- Organization: self-employed
- Message-ID: <4gkvvj$b5d@news.bridge.net>
- References: <4gj6pb$gb3@nntp.ucs.ubc.ca>
- NNTP-Posting-Host: ppp-mia3-116.bridge.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
-
-
- >>>>>
- class MyClass {
- public:
- unsigned int a;
- void function();
- };
- void MyClass::function () {
- asm {
- mov ax,a
- ... Do stuff ...
- }
- }
-
-
- For some reason, this will not compile!!!
- <<<<<
-
-
- The assembler is unable to get you the machine address of "a" because
- there IS no single "a". Instead, "a" is a class member and every MyClass
- object contains an "a".
-
- You will have to provide the address of a MyClass, and add the offset
- of an "a" from that.
-
- The C++ syntax for getting the offset is
-
- & MyClass::a
-
- I don't know whether your assembler will understand uit.
-
- David
-
-
-